package lab01;

import java.util.Random;
import java.util.Scanner;

/**
 * Created by Lenovo on 2017/10/10.
 */
public class test08 {
    public static void main(String[] args) {
        int rightNum=new Random().nextInt(100)+1;
        Scanner scanner=new Scanner(System.in);

        int sr=0;
        do {
            System.out.println("请输入您猜测的数字(1-100)!");
            sr = scanner.nextInt();
            if (sr > rightNum) {
                System.out.println("猜大了！");
            } else if (sr < rightNum) {
                System.out.println("猜小了！");
            }
        }while(sr!=rightNum);
        System.out.println("猜对了"+ rightNum);
    }
}
